import os
# os.path.join(os.path.dirname(os.path.abspath(__file__)))
from. langchain_customized_huggingface import HuggingFaceBgeEmbeddings



def get_embedding(model_path, lang="zh", device='cuda', normalize_embeddings=True):
    model_name = os.path.basename(os.path.dirname(model_path))
    model_kwargs = {'device': device}
    encode_kwargs = {'normalize_embeddings': normalize_embeddings}
    return HuggingFaceBgeEmbeddings(
        model_name=model_name,
        model_path=model_path,
        model_kwargs=model_kwargs,
        encode_kwargs=encode_kwargs,
    )


if __name__ == '__main__':
    emb = get_embedding("F:/models/BAAI/bge-large-en-v1.5")